package com.zyz.K_集合.Map接口一HashMap;

import java.util.HashMap;

/**
 * @author: vick
 * @Date: 2025/3/30
 * @Description:
 * @version: 1.0
 */
public class Demo2 {
    public static void main(String[] args) {
        HashMap hashMap = new HashMap();
        //添加
        hashMap.put("001", "aa");
        hashMap.put("002", "bb");
        hashMap.put("003", "cc");
        hashMap.put("004", "dd");
        System.out.println(hashMap);

        System.out.println("====");
        //获取
        Object object = hashMap.get("001");
        System.out.println(object);

        System.out.println("====");
        //是否包含指定的key
        boolean b1 = hashMap.containsKey("001");
        System.out.println(b1);
        boolean b2 = hashMap.containsValue("aa");
        System.out.println(b2);

        System.out.println("====");
        System.out.println(hashMap.isEmpty());
    }
}
